import request from '@/utils/request'

/**
 * 员工管理API
 */
export const employeeApi = {
  /**
   * 分页查询员工列表
   */
  getEmployeeList(params) {
    return request({
      url: '/employee/list',
      method: 'get',
      params
    })
  },

  /**
   * 根据ID查询员工
   */
  getEmployeeById(id) {
    return request({
      url: `/employee/${id}`,
      method: 'get'
    })
  },

  /**
   * 查询所有员工
   */
  getAllEmployees() {
    return request({
      url: '/employee/all',
      method: 'get'
    })
  },

  /**
   * 新增员工
   */
  addEmployee(data) {
    return request({
      url: '/employee',
      method: 'post',
      data
    })
  },

  /**
   * 更新员工
   */
  updateEmployee(data) {
    return request({
      url: '/employee',
      method: 'put',
      data
    })
  },

  /**
   * 删除员工
   */
  deleteEmployee(id) {
    return request({
      url: `/employee/${id}`,
      method: 'delete'
    })
  },

  /**
   * 更新员工状态
   */
  updateEmployeeStatus(id, workState) {
    return request({
      url: `/employee/status/${id}`,
      method: 'put',
      params: { workState }
    })
  }
}